package _14泛型方法的定义和使用;

public class Demo {
    public static void main(String[] args) {
        Integer[] a = {1,2,3,4};
        printArray(a);


        Double[] b ={1.1,1.2,1.3};
        printArray(b);
    }
    //打印数组
    public static <T> void printArray(T[] t){

        System.out.print("[");
        for (int i = 0; i < t.length; i++) {
            if (i==t.length-1){
                System.out.print(t[i]);
            }else{
                System.out.print(t[i]+",");

            }


        }
        System.out.println("]");
    }
}
